package sdk.webview.fmc.com.fmcsdk.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import sdk.webview.fmc.com.fmcsdk.R;
import sdk.webview.fmc.com.fmcsdk.util.Constant;
import sdk.webview.fmc.com.fmcsdk.util.ToastUtils;
import sdk.webview.fmc.com.fmcsdk.util.UserHelper;
import sdk.webview.fmc.com.fmcsdk.util.Utility;
import sdk.webview.fmc.com.fmcsdk.util.XLog;


/**
 * 修改密码的dialog
 */
public class ChangePasswordTipsDialog extends Dialog {
	private Context context;



    public ChangePasswordTipsDialog(Context context) {
		super(context, R.style.Dialog);
		this.context = context;
	}



	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.change_password_tips_dialog);

		TextView cancel = (TextView) findViewById(R.id.cancel);
		TextView tv_tips = (TextView) findViewById(R.id.tv_tips);
		TextView tv_level_tips = (TextView) findViewById(R.id.tv_level_tips);
		cancel.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				dismiss();
			}
		});

		String psdLevel = PreferenceManager.getDefaultSharedPreferences(context).getString(Constant.PSD_LEVEL, "0");
		if (psdLevel.equals("0")){
			tv_tips.setText(context.getResources().getString(R.string.password_change_content1));
		}else if (psdLevel.equals("1")){
			tv_tips.setText(context.getResources().getString(R.string.password_change_content2));
		}else if (psdLevel.equals("2")){
			tv_tips.setText(context.getResources().getString(R.string.password_change_content3));
		}

		String PSD_MODIFIY = PreferenceManager.getDefaultSharedPreferences(context).getString(Constant.PSD_MODIFIY, "0");
		if (PSD_MODIFIY.equals("0")){
			tv_level_tips.setText(context.getResources().getString(R.string.password_change_content4));
		}

		//设置dialog的属性
		Window dialogWindow = getWindow();
	    WindowManager.LayoutParams lp = dialogWindow.getAttributes();
	    DisplayMetrics d = context.getResources().getDisplayMetrics(); // 获取屏幕宽、高
	    lp.width = (int) (d.widthPixels * 0.9);
	    dialogWindow.setAttributes(lp);

	}









}
